Repository navigation
fix(studio): a sealed crop draws a layer's insets at its own scale and follows a seek - #8451
Conversation
…e before any press
…from an earlier selection
…cale before any press
…tudio's own preview frame
Edit accuracy: accurate 271 (base branch 271), smooth 59 of thoseThe gate passes. Quarantined, measured but not gated (0) |
terencecho
left a comment
There was a problem hiding this comment.
[P2] Refresh the local crop frame when a seek changes scale without resizing the painted box. In packages/studio/src/components/editor/DomEditCropHandles.tsx:194, the passive measurement is keyed to rounded overlay width and height. A seek can change the layer's intrinsic size and transform together, leaving that key unchanged. The overlay wakes, but the crop keeps its previous local scale.
I extended the sealed-frame fixture with a 200×100 layer at 2× and a 20 px right inset. After measurement, I moved it to 400×200 at 1×, leaving the same 400×200 painted box. The outline stayed at 360 px where the current inset should give 380 px. Refresh on a trusted seek or include the current local dimensions in the invalidation signal. Keep the existing one-read-at-a-time and stale-reply guards.
All 37 focused tests and the required captures check passed. The additional probe reproduced the stale outline in the sealed-frame fixture, without a full Studio browser walk.
— tai (automated review)
terencecho
left a comment
There was a problem hiding this comment.
P2 — Refresh the crop after the sealed frame applies the seek. DomEditCropHandles.tsx keys the new read on Studio’s local currentTime. The sealed adapter posts the seek to the frame, then Studio updates the store before the frame confirms that it has applied the seek. The geometry read is on the editing port and can still measure the old frame. When the seek lands with the same painted width and height, the overlay can wake without changing any dependency of the crop read.
I ran the three focused suites (33 passing), then exercised the existing sealed-frame fixture with the new playhead value arriving before the frame updated its geometry. The old read was still accepted and the outline stayed at 360 px instead of 380 px, even after an overlay render with the same outer box. The new test paints before updating the store, so it misses this ordering. Please re-read after the frame confirms the seek (or tie the read to the frame’s applied seek) and cover the delayed-paint order.
— tai (automated review)
terencecho
left a comment
There was a problem hiding this comment.
The crop refresh now waits for the registered preview frame’s accepted paused-time report. The held-seek test confirms that moving Studio’s playhead alone leaves the crop at its old scale and that the frame’s report refreshes it at the new scale. The 33 focused tests and required CI checks passed.
— tai (automated review)
What
In a sealed preview (Studio cannot script the frame), a selected layer's crop frame now draws its insets at the layer's own scale and size, as an unsealed preview does, in two cases that were wrong before:
Why
A sealed preview's stand-in has no size of its own, so the crop frame needs the layer's untransformed size from the frame. Only a press read it. Separately, the editor overlays wake on a preview's playhead posts only from Studio's own origin, but a sealed frame posts from an opaque origin, so after a seek they waited for the idle poll.
Related work
Refs #8310 (the same gap for a turned layer's crop frame before any press).
How
DomEditCropHandles: while a stand-in is selected and not dragged, it asks the frame for the samegesture-startread a press already makes (readCropFrameStart), once on selection and again whenever its overlay size changes. One read at a time; a change during a read asks once more when it lands. A new selection or a press drops a read still out, so a reply sent for an earlier selection never replaces a newer one. No new message type.bridgePlayback: the check "a post from a preview frame Studio built, from an origin that frame can have" (a registered frame's window plus its possible origins, the opaque one included for a sealed frame) is exported asfromStudioPreview. Playback mirroring already used it.overlayFrameLoop: wakes on a preview post only whenfromStudioPreviewaccepts it, instead of on any post from Studio's own origin. A sealed frame's posts now wake the overlays, and a same-origin window that is not the preview frame no longer does.Before
Sealed preview on main, 3x close-ups of the crop frame (150 px crop on the right).
Layer whose scale tweens from 1 to 1.5, picked in the Layers panel at 3.5 s with no press on the canvas: the crop line is drawn at scale 1 (outline 36 px; unsealed 23 px).
Layer whose width tweens, selected at 1 s, then a seek to 3.5 s: the crop line keeps the size from before the seek (outline 31 px; unsealed 36 px), and the box only follows after the overlays' idle poll (2008 ms in this run).
After
Sealed preview with this change, same walks: both match unsealed.
Layers pick: outline 23 px, as unsealed.
Seek: outline 36 px, settled 27 ms after the seek (unsealed: 28 ms).
Unsealed, for reference:
Test plan
DomEditCropHandles.sealed.test.ts:LayersPanel.opaque.test.ts:overlayFrameLoop.test.ts:fails without the fix:
DomEditCropHandles.tsxas on main, the three crop rows and the Layers panel row fail (the outline is 380 px where 360 px is right);overlayFrameLoop.tsandbridgePlayback.tsas on main, "wakes to full rate when a sealed preview…" (1 frame, more than 5 wanted) and "ignores a same-origin preview post from a window…" (13 frames, at most 2 wanted) fail.The new and changed tests pass three runs in a row; the push gate's covering run (39 Studio test files), Studio
tscand the Fallow audit pass.